<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/DOM练习2.css">
</head>
<body>
    <div class="box">
            <div class="title">
                <p>首页</p>
                <ul>
                    <li>11</li>
                    <li>11</li>
                    <li>11</li>
                </ul>
            </div>
            <div class="title">
                <p>用户信息</p>
                <ul>
                    <li>11</li>
                    <li>11</li>
                    <li>11</li>
                </ul>
            </div>
            <div class="title">
                <p>注册</p>
                <ul>
                    <li>11</li>
                    <li>11</li>
                    <li>11</li>
                </ul>
            </div>
            <div class="title">
                <p>登录</p>
                <ul>
                    <li>11</li>
                    <li>11</li>
                    <li>11</li>
                </ul>
            </div>
            <div class="title">
                <p>设置</p>
                <ul>
                    <li>11</li>
                    <li>11</li>
                    <li>11</li>
                </ul>
        </div>
        <!-- <div class="con">
            

            <ul>
                <li>21</li>
                <li>22</li>
                <li>23</li>
            </ul>
            <ul>
                <li>31</li>
                <li>32</li>
                <li>33</li>
            </ul>
            <ul>
                <li>41</li>
                <li>42</li>
                <li>43</li>
            </ul>
            <ul>
                <li>51</li>
                <li>52</li>
                <li>53</li>
            </ul>
           
        </div> -->
    </div>
    <script>
        var title=document.querySelectorAll('.title p')
        var ul=document.querySelectorAll('.title ul')
        title.forEach(function(p,i){
            p.onclick=function(){
                ul[i].classList.toggle('show')
                p.classList.toggle('show1')

            }
        })
        
    </script>
</body>
</html>